import { request } from '@/utils/request'

export const uploadService = {
  /**
   * 上传图片/视频文件
   * @param file 文件对象
   * @param storageType 存储类型（可选）
   * @returns Promise<string> 返回上传后的文件URL
   */
  uploadImage: (file: File, storageType?: string): Promise<string> => {
    const formData = new FormData()
    formData.append('file', file)
    if (storageType) {
      formData.append('storageType', storageType)
    }
    return request.post<string>('/file/uploadImage', {
      body: formData,
    })
  },
}
